// JavaScript Document
$(document).ready(function(e) {
	$('#nameIpt').focus(function(e) {
        $("#nameTips").css("display","block");
		$("#conflictDiv").css("display","none");
		$('#mainRegA').css("display","block");
    });
	
	$('#mainCfmPwdIpt').blur(function(e) {
		var pwd=$('#mainPwdIpt').val();
		var cfmPwd=$('#mainCfmPwdIpt').val();
		if(pwd!=cfmPwd)
		{
			$('#cfmpwdDiv').css("display","block");
			$('#mainCfmPwdTips').css("display","none");
			$('#mainRegA').css("display","none");
		}
		if(pwd==cfmPwd)
		{
			$('#cfmpwdDiv').css("display","none");
			$('#mainCfmPwdTips').css("display","block");
			$('#mainRegA').css("display","block");
		}
    });
	
	$('#nameIpt').blur(function(e) {
		var name=$('#nameIpt').val();
		if(name!="")
		{
			$.get("reg.ashx",{name:name},function(data){
				if(data=="1")
				{
					$("#nameTips").css("display","none");
					$("#conflictDiv").css("display","block");
					$('#mainRegA').css("display","none");
				}
			});
		}
    });
	
	$('#mainRegA').click(function(e) {
		var name=$('#nameIpt').val();
		var pwd=$('#mainPwdIpt').val();
		var email=$('#mainEmailIpt').val();
		var qq=$('#mainQQIpt').val();
		var tel=$('#mainTelIpt').val();
		if(name!=""&&pwd!="")
		{
			$.get("reg.ashx",{name:name,pwd:pwd,email:email,qq:qq,tel:tel},function(data){
				if(data=="2")
				{
					alert('您已注册成功');
					location.href="default.aspx";	
				}
			});
		}
    });
});